package com.homelock.constants;

public enum DevUserRoleEnum {
  OWNER(1, "主人"),
  ADMIN(2, "管理员"),
  USER(3, "普通用户"),
  ;
  private int role;
  private String desc;
  private DevUserRoleEnum(int role, String desc) {
    this.role = role;
    this.desc = desc;
  }
  public int getRole() {
    return role;
  }
  public String getDesc() {
    return desc;
  }
  public static boolean isAdmin(Integer role) {
    if(null == role) {
      return false;
    }
    if(OWNER.role == role || ADMIN.role == role) {
      return true;
    }
    return false;
  }
  
  public static Integer getAdminFlag(Integer role) {
    if(isAdmin(role)) {
      return 1;
    }
    return 0;
  }
}
